package com.xy.manage.service.impl;


import java.util.List;
import java.util.Map;
import java.util.Date;
import com.xy.core.util.BeanUtil;
import com.xy.common.page.Pagination;
import com.xy.core.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.xy.manage.dao.TsurveyquestionDao;
import com.xy.manage.model.Tsurveyquestion;
import com.xy.manage.service.TsurveyquestionService;

@Service
@Transactional
public class TsurveyquestionServiceImpl extends BaseServiceImpl<Tsurveyquestion> implements
		TsurveyquestionService {
	private TsurveyquestionDao tsurveyquestionDao;

	public TsurveyquestionServiceImpl(TsurveyquestionDao paramAppRoleDao) {
		super(paramAppRoleDao);
		this.tsurveyquestionDao = paramAppRoleDao;
	}

	@Override
	public boolean checkExist(String paraName, String paraValue) {
		return tsurveyquestionDao.checkExist("Tsurveyquestion", paraName, paraValue);
	}

	@Override
	public List<Tsurveyquestion> getTsurveyquestion(Map<String, Object> map) {
		return tsurveyquestionDao.getTsurveyquestion(map);
	}
	@Override
	public Pagination getTsurveyquestionByPage(Map<String, Object> map, int pageNo,
			int pageSize) {
		// TODO Auto-generated method stub
		return tsurveyquestionDao.getTsurveyquestionByPage(map, pageNo, pageSize);
	}
	 
   @Override
	public Tsurveyquestion save(Tsurveyquestion tsurveyquestion) {
	//	tsurveyquestion.setModtime(new Date());
		if(tsurveyquestion.getQuestionid()==null){
			//新增
        	return super.save(tsurveyquestion);
		}else{
			//更新
			Tsurveyquestion tsurveyquestion1=tsurveyquestionDao.get(tsurveyquestion.getQuestionid());
			try {
				BeanUtil.copyNotNullProperties(tsurveyquestion1, tsurveyquestion);
			} catch (Exception e) {
				e.printStackTrace();
			}  
			return super.save(tsurveyquestion1);
		}
	}
}